#pragma once

// 激光雷达
#include "base_component.h"

class Lidar : public BaseComponent {
public:
    Lidar();
    void print() override;
    int save(YAML::Node& node) override;
    int setLidarModel(std::string model);
    void setLidarChannelCount(int channelCount);
    void setLidarRange(float range);
    void setPowerConsumption(float consumption);

private:
    std::string _lidarModel;
    int _lidarChannelCount;
    float _lidarRange;
    float _powerConsumption;
};

namespace YAML {
template <>
struct convert<Lidar> {
    static bool decode(const Node& node, Lidar& rhs) {
        rhs.setLidarModel(node["lidarModel"].as<std::string>());
        rhs.setLidarChannelCount(node["lidarChannelCount"].as<int>());
        rhs.setLidarRange(node["lidarRange"].as<float>());
        rhs.setPowerConsumption(node["powerConsumption"].as<float>());
        return true;
    }
};
}  // namespace YAML
